package com.cdtye.itps.cms.service.origindata;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cdtye.common.mybatiscore.base.BaseService;
import com.cdtye.itps.cms.dao.origindata.entity.JcjcDetectC2Job;
import com.cdtye.itps.cms.dao.origindata.vo.JcjcDetectC2JobVo;
import com.cdtye.itps.cms.mapper.origindata.JcjcDetectC2JobMapper;
import com.cdtye.itps.cms.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class JcjcDetectC2JobService extends BaseService<JcjcDetectC2JobMapper, JcjcDetectC2Job> {

    @Autowired
    private JcjcDetectC2JobMapper baseMapper;
    /**
     *2c原始数据分页查询
     */
    public IPage<Map<String,Object>> listPage(JcjcDetectC2JobVo vo){
        if (vo.getEndDate()!=null) {
            String endDate = DateUtils.DateToString(vo.getEndDate(),"yyyy-MM-dd")+" 23:59:59";
            vo.setEndDate(DateUtils.StringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        return baseMapper.listPage(vo.page(),vo);
    }

    /**
     * 新增
     * @return
     */
    public boolean insertJcjcDetectC2Job(JcjcDetectC2Job jdc){
        return this.saveOrUpdate(jdc);
    }
}
